import request from '@/utils/request'
import { getToken } from '@/utils/auth'
export default{
  // 问答列表页-------------------------
  getHealthyQA(page_num,page_size){
    return request({
      url:`/emergencyQA/questions?pageNum=${page_num}&pageSize=${page_size}`,
      method: 'GET',
      headers: {
             'Authorization':getToken()
            }
    })
  },
  getHealthyQAList(page_num,page_size,searchObj){
    return request({
      url:`/emergencyQA/selectThem/${page_num}/${page_size}`,
      method: 'POST',
      data:searchObj,
      headers: {
              'Authorization':getToken()
            }
    })
  },
  reqAddOrUpdateQA(QA){
    if(QA.questionId){
      return request({url:'/emergencyQA',method:'PUT',data:QA, headers: {
              'Authorization':getToken()
            }});
    }
    else{
      return request({url:'/emergencyQA',method:'POST',data:QA, headers: {
              'Authorization':getToken()
            }});
    }
  },
  reqEditQA(QA){
    return request({
      url:'/emergencyQA/updateFaq',
      method:'POST',
      data:QA,
      headers:{
        'Authorization':getToken()
      }
    })
  },
   //问答删除设置
   delqa(questionId){
    return request({
      method: 'DELETE',
		  url: '/emergencyQA?questionId=' + questionId,
      headers: {
             'Authorization':getToken()
            }
    })
  },
  //批量删除课程
  batchRemoveQA(idList){
    return request({
      url:`/emergencyQA/F_batchDel`,
      method:'DELETE',
      data:idList,
      headers: {
              'Authorization':getToken()
            }
    })
  }
}
